package com.gitee.funcy.disruptorlearn.ch03.sigle;

import com.lmax.disruptor.EventTranslator;

import java.util.Random;

/**
 * @author fangchengyan
 * @date 2019-03-15 18:08
 */
public class TradeEventTranslator implements EventTranslator<Trade> {

    @Override
    public void translateTo(Trade event, long sequence) {
        this.generateTrade(event);

    }

    private void generateTrade(Trade event) {
        Random random = new Random();
        event.setPrice(random.nextDouble() * 9999);
    }
}
